<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.candy.pojo.Student" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/8/14
  Time: 14:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>EL表达式</title>
</head>
<body>
    <%
        pageContext.setAttribute("stuName","zhangsan");
        request.setAttribute("stuName","lisi");
        session.setAttribute("stuName","wangwu");
        List<String> lst = new ArrayList<>();
        lst.add("zhaoliu");
        lst.add("tom");
        request.setAttribute("lstName",lst);
        Map<String,Object> map=new HashMap<>();
        map.put("stuName","xiaoming");
        session.setAttribute("mapstu",map);
        Student stu0=new Student();
        stu0.setStuName("lily");
        stu0.setStuAge(21);
        session.setAttribute("stu0",stu0);
    %>
    学生姓名: ${stuName}
    <br>
    学生姓名(session): ${sessionScope.stuName}
    <br>
    el表达式读取集合list元素: ${requestScope.lstName[1]}
    <br>
    el表达式读取对象元素: ${sessionScope.stu0}
    <br>
    el表达式读取对象元素: ${sessionScope.stu0.stuAge}
    <br>
    el表达式读取对象元素: ${sessionScope.stu0["stuAge"]-5>18?"成年":"未成年"}
    <br>
    el表达式读取map元素: ${sessionScope.mapstu["stuName"]}
    <br>
</body>
</html>
